/**
 * 
 */
package quartz.listener;

import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.JobListener;

/**
 * 
 *监听job
 */
public class MyJobListener implements JobListener {

	/* 
	 */
	@Override
	public String getName() {
		String name = this.getClass().getSimpleName();
		System.out.println("监听器的名称:" + name);
		return name;
	}

	/* 
	 */
	@Override
	public void jobToBeExecuted(JobExecutionContext context) {
		String name = context.getJobDetail().getKey().getName();
		System.out.println("job的名称是：" + name + "Scheduler在JobDetail将要呗执行时调用的方法");

	}

	/* 
	 */
	@Override
	public void jobExecutionVetoed(JobExecutionContext context) {
		String name = context.getJobDetail().getKey().getName();
		System.out.println("job的名称是：  " + name + "    Scheduler在JobDetail即将被执行，但又被TriggerListener否决时候会调用的方法");

	}

	/* 
	 */
	@Override
	public void jobWasExecuted(JobExecutionContext context, JobExecutionException jobException) {
		String name = context.getJobDetail().getKey().getName();
		System.out.println("job的名称是：  " + name + "    Scheduler在JobDetail执行之后时候会调用的方法");

	}

}
